# @Author   : 懒羊羊
# @File     : update_myinfo.py
# @Time     : 2024/12/11 19:27


from appium.webdriver.common.appiumby import AppiumBy
from pages.basepage import BasePage


class MyInfo(BasePage):
    my_name = (AppiumBy.ID, 'com.kkpodcast:id/input_nick_et')
    update = (AppiumBy.ID, 'com.kkpodcast:id/complete_tv')
    name = (AppiumBy.ID, 'com.kkpodcast:id/nick_name_tv')
    error_message1 = (AppiumBy.XPATH, '//*[@text="请输入新昵称"]')

    def go_to_update_name(self, name1='懒羊羊5'):
        # 输入昵称
        if name1 == None:
            name1 = ''
        self.getElement(self.my_name).send_keys(name1)

        # 点击确认修改
        self.getElement(self.update).click()

    def update_ok(self):
        return self.get_Ele_Value(self.name)

    def update_error1(self):
        return self.get_Ele_Value(self.error_message1)


if __name__ == '__main__':
    from pages.loginpage import Login

    fp = Login().go_to_firstpage()
    fp.myinfo()
    fp.fanhui()
    fp.lougout()
    fp.d.quit()
